<?php
/**
 * YOS News Crawler Component
 *
 * @package		yos_news_crawler
 * @subpackage	Components
 * @link		http://yopensource.com
 * @author		yopensource
 * @copyright 	yopensource (yopensource@gmail.com)
 * @license		Commercial
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.controller');

/**
 * Translator Component Controller
 *
 * @package		yos_translator
 */
class YOS_NewsController extends JController
{
	function works(){
		global $mainframe;
		
		//get default execution time
		$defalutExecution = ini_get('max_execution_time');
		//trying to set limit to 2 minutes, because I will run the cronjob every 5 minutes
		@set_time_limit(60 * 2);
		
		$model =& $this->getModel('works');
		if (JRequest::getInt('debug')) { echo date('H:i:s')."[CONTROLLER] created model object<br />\n"; }
		if (JRequest::getInt('debug')) { echo date('H:i:s')."[CONTROLLER] task works BEGIN<br />\n"; }
		$model->works();
		if (JRequest::getInt('debug')) { echo date('H:i:s')."[CONTROLLER] task works END<br />\n"; }
		
		if ($arr_errors = $model->getErrors()) {
			foreach ($arr_errors as $str_error){
				echo '<font color="red">[ERROR]</font> '.$str_error.'<br />';
			}
		}
		//restore default setting
		@set_time_limit($defalutExecution);
		die();
	}
}

